package UILayer;
import java.util.*;
import CtrlLayer.*;

public class NoteUI
{
    NoteController noteController;
    public NoteUI()
    {
        noteController = new NoteController();
    }

    public void noteMenuStart()
    {

        boolean exit=false;
        while (!exit) 
        {
            int choice = writeNoteMenu();

            switch(choice){
                case 1:
                startInvoiceSale();
                break;
                case 2:
                startInvoiceLease();
                break;
                case 3:
                startDispatchNote();
                break;
                case 4:
                startDeliveryNote();
                break;
                case 0:
                exit = true;
                break;

            }

        }
    }

    private int writeNoteMenu()
    {       

        Scanner keyboard = new Scanner(System.in);
        System.out.println("\f *** Note Menu ***");
        System.out.println(" (1) Generate Invoice for sale");
        System.out.println(" (2) Generate Invoice for lease");
        System.out.println(" (3) Generate Dispatch note");
        System.out.println(" (4) Generate Delivery note ");

        System.out.println(" (0) Back");

        System.out.print("\n Make your choice: ");
        int choice = keyboard.nextInt();
        return choice;
    }

    private void startInvoiceSale()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Enter the ID of the sale: ");
        int id = Integer.parseInt(keyboard.nextLine());
        noteController.generateSaleInvoice(id);
        pause();
    }

    private void startInvoiceLease()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Enter the ID of the lease: ");
        int id = Integer.parseInt(keyboard.nextLine());
        noteController.generateLeaseInvoice(id);
        pause();
    }

    private void startDispatchNote()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Enter the ID of the delivery: ");
        int id = Integer.parseInt(keyboard.nextLine());
        noteController.generateDispatchNote(id);
        pause();
    }

    private void startDeliveryNote()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Enter the ID of the delivery: ");
        int id = Integer.parseInt(keyboard.nextLine());
        noteController.generateDeliveryNote(id);
        pause();
    }

  
    private void pause()
    {
        Scanner keyboard = new Scanner(System.in);
        String vent = keyboard.nextLine();
    }

}
